/*
 * Copyright (c) 2010. Dylan Schell.
 */

package nl.xs4all.dylanschell.deckprinter.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class DeckDescriptor implements Serializable
{
    private static final long serialVersionUID = 1L;

    public static final String SECTION_MAIN = "Main";
    public static final String SECTION_SIDEBOARD = "Sideboard";

    private final String name;
    private final Map<String, List<CardInDeck>> cards = new HashMap<String, List<CardInDeck>>();

    public DeckDescriptor(String name)
    {
        this.name = name;
    }

    public String getName()
    {
        return name;
    }

    public List<CardInDeck> getCardsInSection(String section)
    {
        List<CardInDeck> result = cards.get(section);
        if (result == null)
        {
            result = new ArrayList<CardInDeck>();
            cards.put(section, result);
        }
        return result;
    }

    public List<CardInDeck> getMain()
    {
        return getCardsInSection(SECTION_MAIN);
    }

    public List<CardInDeck> getSideboard()
    {
        return getCardsInSection(SECTION_SIDEBOARD);
    }

    public Set<String> getSections()
    {
        return cards.keySet();
    }
}
